class Admin extends User {
    private Cinema cinema;

    public Admin(String username, String password) {
        super(username, password, "Admin");
        this.cinema = Cinema.getInstance();
    }

    public Manager createManager(String username, String password) {
        Manager manager = new Manager(username, password);
        cinema.getUserManagementSystem().registerUser(manager);
        System.out.println("已创建经理: " + username);
        return manager;
    }

    public Reception createReception(String username, String password) {
        Reception reception = new Reception(username, password);
        cinema.getUserManagementSystem().registerUser(reception);
        System.out.println("已创建前台: " + username);
        return reception;
    }

    public Hall createHall(String name, int rows, int cols) {
        Hall hall = new Hall(name, rows, cols);
        cinema.addHall(hall);
        System.out.println("已创建放映厅: " + name);
        return hall;
    }

    public void viewHalls() {
        System.out.println("所有放映厅:");
        for (Hall hall : cinema.getHalls()) {
            System.out.println("- " + hall.getName());
        }
    }

    public void viewAllUsers() {
        System.out.println("所有用户:");
        for (User user : cinema.getUserManagementSystem().getAllUsers()) {
            System.out.println("- " + user.getUsername() + " (" + user.getRole() + ")");
        }
    }
}
